include([
 'renderers.NodeRenderer'
 , 'shapes.Line'], 

function(){

	declare('renderers.WireFrameRenderer');
	
	WireFrameRenderer = NodeRenderer.extend({
		init : function(name){
			this._super(name || 'WireFrameRenderer' + (Renderer.count++));
		},
		renderObject : function(gw, obj){
			var c = gw.c;
			var m = this.material;
			var lns = this.toLines(obj);
			for(var i=0; i< lns.length;i++){
				m.render(gw, lns[i]);
			}
			if( obj.children ){
				for(var e in obj.children ){
					if( obj.children[e] ) this.renderObject(gw, obj.children[e]);
				}
			}
			return true;
		},
		toLines : function(obj){
			var results = [];
			if( obj.meshData ){
				var mesh = obj.meshData();
				for(var i=0; i < mesh.length; i++){
					var next = (i+1) % mesh.length;
					results.push(new Line(mesh[i], mesh[next]));
				}
			}
			return results;
		},
	});
});